#define _CRT_SECURE_NO_WARNINGS 1
int majorityElement(int* nums, int numsSize) {
    int m = nums[0];
    int count = 1;
    for (int i = 1; i < numsSize; i++)
    {
        if (nums[i] == m)
            count++;
        else
        {
            if (count == 0)
            {
                m = nums[i];
                count++;
            }
            else
                count--;
        }
    }
    return m;
}